import java.io.IOException;
import java.net.Inet4Address;
import java.net.ServerSocket;


public class SocketListener {
	static final int portNum = 7005;
	
	public static void main(String[] args) throws IOException {
		System.out.println("Starting Listener:" +Inet4Address.getLocalHost().getHostAddress());
        ServerSocket serverSocket = null;
        boolean listening = true;

        try {
            serverSocket = new ServerSocket(portNum);
        } catch (IOException e) {
            System.err.println("Could not listen on port: "+ portNum);
            System.exit(-1);
        }

        while (listening){
        	new ListenerThread(serverSocket.accept(), Inet4Address.getLocalHost()).start();
        }
	    
        serverSocket.close();
    }
}
